package com.ruicar.afs.cloud.image.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruicar.afs.cloud.image.entity.ComAttachmentFile;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * @author infinity
 * @version 1.0
 * @date 2020/7/13 14:59
 */
@Data
public class AuditFileDetailsVo {

    @ApiModelProperty("附件表主键ID")
    @JsonSerialize(using = ToStringSerializer.class)
    @JSONField(serializeUsing = com.alibaba.fastjson.serializer.ToStringSerializer.class)
    private Long id;

    @ApiModelProperty("文件MD5值")
    private String fileId;

    @ApiModelProperty("文件名")
    private String fileName;

    @ApiModelProperty("附件id")
    private String attachmentCode;

    @ApiModelProperty("文件状态")
    private String fileStatus;

    @ApiModelProperty("文件类型")
    private String fileType;

    @ApiModelProperty("历史版本")
    private String historyVersion;

    @ApiModelProperty("是否电子签文件")
    private String isElectronic;

    @ApiModelProperty("影像文件路径")
    private String imageUrl;

    @ApiModelProperty("缩略图文件路径")
    private String thumUrl;

    @ApiModelProperty("上传时间/更新时间")
    private Date uploadTime;

    public static AuditFileDetailsVo convertFrom(ComAttachmentFile comAttachmentFile) {
        AuditFileDetailsVo vo = new AuditFileDetailsVo();
        vo.setId(comAttachmentFile.getId());
        vo.setFileId(comAttachmentFile.getFileId());
        vo.setFileName(comAttachmentFile.getFileName());
        vo.setFileType(comAttachmentFile.getFileType());
        vo.setFileStatus(comAttachmentFile.getFileStatus());
        vo.setHistoryVersion(comAttachmentFile.getHistoryVersion());
        vo.setUploadTime(comAttachmentFile.getUploadTime());
        vo.setIsElectronic(comAttachmentFile.getIsElectronic());
        vo.setAttachmentCode(comAttachmentFile.getAttachmentCode());
        return vo;
    }

}
